//
//  BDPayStyleTableViewCell.m
//  BadBoy
//
//  Created by wen on 2017/7/10.
//  Copyright © 2017年 com.8xiong. All rights reserved.
//

#import "BDPayStyleTableViewCell.h"

@interface BDPayStyleTableViewCell ()

@property (nonatomic, strong) UIImageView *chooseImageView;

@end

@implementation BDPayStyleTableViewCell

- (void)configeWithModel:(id)model{
    self.imageView.image = [UIImage imageNamed:model[@"image"]];
    self.textLabel.text = model[@"title"];
    
    if ([model[@"isChoose"] boolValue] == YES) {
        self.chooseImageView.image = [UIImage imageNamed:@"queren_sel"];
    }else{
        self.chooseImageView.image = [UIImage imageNamed:@"queren"];
    }
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.imageView.size = CGSizeMake(25, 25);
    self.imageView.left = 10;
    self.imageView.centerY = self.height / 2.0;
    
    self.textLabel.font = [UIFont systemFontOfSize:15];
    self.textLabel.textColor = [UIColor colorWithHexString:@"#1c1c1c"];
    [self.textLabel sizeToFit];
    self.textLabel.left = self.imageView.right + 20;
    self.textLabel.centerY = self.imageView.centerY;
    
    self.chooseImageView.size = CGSizeMake(21, 21);
    self.chooseImageView.right = self.width - 10;
    self.chooseImageView.centerY = self.imageView.centerY;
}

- (UIImageView *)chooseImageView{
    if (!_chooseImageView) {
        self.chooseImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_chooseImageView];
    }
    return _chooseImageView;
}

@end
